package com.company.utils;

public class ModifyOrderInfo {
    public void modify(String trackingNumber,String recipinetInfo){
        for (int i = 0; i < MyOrderUtil.orders.size(); i++) {
            if (trackingNumber.equals(MyOrderUtil.orders.get(i).getTrackingNumber()) && MyOrderUtil.orders.get(i).getModifyCount()==0){
                MyOrderUtil.orders.get(i).setRecipientInfo(recipinetInfo);
                System.out.println("修改成功!");
                MyOrderUtil.orders.get(i).setModifyCount(1);
                break;
            }else if(trackingNumber.equals(MyOrderUtil.orders.get(i).getTrackingNumber()) && MyOrderUtil.orders.get(i).getModifyCount()==1){
                System.out.println("您已修改过此订单,不能再次修改！");
                break;
            }else if(!trackingNumber.equals(MyOrderUtil.orders.get(i).getTrackingNumber())){
                System.out.println("暂无次订单编号！");
                break;
            }
        }
        System.out.println("--------更新后的订单信息-------");
        for (int i = 0; i < MyOrderUtil.orders.size(); i++) {
            if (trackingNumber.equals(MyOrderUtil.orders.get(i).getTrackingNumber())){
                System.out.println("快递单号: "+MyOrderUtil.orders.get(i).getTrackingNumber());
                System.out.println("收件人信息: "+MyOrderUtil.orders.get(i).getRecipientInfo());
                System.out.println("取件方式: "+MyOrderUtil.orders.get(i).getPickupType());
                System.out.println("寄件日期: "+MyOrderUtil.orders.get(i).pickupDate);
                System.out.println("-------------------");
                break;
            }
        }
    }
}
